import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:moose_app/ui/values/values.dart';
import 'package:moose_app/ui/widgets/search/search_input.dart';

import 'address_choose_map.dart';

class ATHAddressChooseBody extends StatefulWidget {
  @override
  _ATHAddressChooseBodyState createState() => _ATHAddressChooseBodyState();
}

class _ATHAddressChooseBodyState extends State<ATHAddressChooseBody> {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.all(kSize20),
      child: Column(
        children: [
          Container(
            margin: EdgeInsets.only(bottom: kSize16),
            child: Row(
              children: [
                Container(
                  constraints: BoxConstraints(minWidth: kSize120),
                  child: Row(
                    children: [
                      Text(
                        "大唐",
                        style: TextStyle(fontSize: kSize30),
                      ),
                      SvgPicture.asset(
                        "assets/icons/icon_arrow_down.svg",
                        height: kSize28,
                      )
                    ],
                  ),
                ),
                Expanded(child: ATHSearchInput(hintText: "请输入收货地址"))
              ],
            ),
          ),
          ATHAddressChooseMap(),
          Expanded(
              child: ListView.builder(
            itemCount: 10,
            itemBuilder: (BuildContext context, int index) {
              return ATHAddressDetailItem();
            },
          ))
        ],
      ),
    );
  }
}

class ATHAddressDetailItem extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      height: kSize130,
      decoration:
          BoxDecoration(border: Border(bottom: BorderSide(color: kColorF1))),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          Container(
            width: kSize80,
            alignment: Alignment.center,
            child: Container(
              width: kSize20,
              height: kSize20,
              decoration: BoxDecoration(
                  color: kColorPrimary,
                  borderRadius: BorderRadius.all(Radius.circular(kSize10))),
            ),
          ),
          Expanded(
            child: Container(
              margin: EdgeInsets.only(left: kSize10),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(
                    "醉仙楼",
                    style: TextStyle(fontSize: kFontSize36, color: kColor33),
                  ),
                  Text(
                    "长安街 119 号 119 米",
                    style: TextStyle(color: kColor66),
                  ),
                ],
              ),
            ),
          )
        ],
      ),
    );
  }
}
